static void
gnome_shell_plugin_init (GnomeShellPlugin *shell_plugin)
{
- _shell_global_set_plugin (shell_global_get(), MUTTER_PLUGIN(shell_plugin));
-
meta_prefs_override_preference_location ("/apps/metacity/general/button_layout",
"/desktop/gnome/shell/windows/button_layout");
}
int status;
const char *shell_js;
char **search_path;
+ ShellGlobal *global;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
shell_plugin->gjs_context = gjs_context_new_with_search_path(search_path);
g_strfreev(search_path);
- _shell_global_set_gjs_context (shell_global_get (), shell_plugin->gjs_context);
+ /* Initialize the global object here. */
+ global = shell_global_get ();
+
+ _shell_global_set_plugin (global, MUTTER_PLUGIN(shell_plugin));
+ _shell_global_set_gjs_context (global, shell_plugin->gjs_context);
if (!gjs_context_eval (shell_plugin->gjs_context,
"const Main = imports.ui.main; Main.start();",
}
static gboolean
-on_screen_size_changed_cb (gpointer data)
+update_screen_size (ShellGlobal *global)
{
- ShellGlobal *global = SHELL_GLOBAL (data);
-
int width, height;
mutter_plugin_query_screen_size (global->plugin, &width, &height);
- if (global->last_change_screen_width != width || global->last_change_screen_height != height)
- {
- g_signal_emit (G_OBJECT (global), shell_global_signals[SCREEN_SIZE_CHANGED], 0);
- global->last_change_screen_width = width;
- global->last_change_screen_height = height;
+ if (global->last_change_screen_width == width && global->last_change_screen_height == height)
+ return FALSE;
- /* update size of background actor to fix tiled backgrounds */
- clutter_actor_set_size (CLUTTER_ACTOR (global->root_pixmap),
- width, height);
- }
+ global->last_change_screen_width = width;
+ global->last_change_screen_height = height;
+
+ /* update size of background actor to fix tiled backgrounds */
+ if (global->root_pixmap)
+ clutter_actor_set_size (CLUTTER_ACTOR (global->root_pixmap),
+ width, height);
+
+ return TRUE;
+}
+
+static gboolean
+on_screen_size_changed_cb (gpointer data)
+{
+ ShellGlobal *global = SHELL_GLOBAL (data);
+
+ if (update_screen_size (global))
+ g_signal_emit (G_OBJECT (global), shell_global_signals[SCREEN_SIZE_CHANGED], 0);
return FALSE;
}
NULL);
}
-static void
-global_plugin_notify_screen (GObject *gobject,
- GParamSpec *pspec,
- gpointer data)
-{
- ShellGlobal *global = SHELL_GLOBAL (data);
- ClutterActor *stage = mutter_plugin_get_stage (MUTTER_PLUGIN (gobject));
-
- g_signal_connect (stage, "notify::width",
- G_CALLBACK (global_stage_notify_width), global);
- g_signal_connect (stage, "notify::height",
- G_CALLBACK (global_stage_notify_height), global);
-}
-
void
_shell_global_set_plugin (ShellGlobal *global,
MutterPlugin *plugin)
{
+ ClutterActor *stage;
+
g_return_if_fail (SHELL_IS_GLOBAL (global));
g_return_if_fail (global->plugin == NULL);
global->plugin = plugin;
global->wm = shell_wm_new (plugin);
- /* At this point screen is NULL, so we can't yet do signal connections
- * to the width and height; we wait until the screen property is set
- * to do that. Note that this is a one time thing - screen will never
- * change once first set.
- */
- g_signal_connect (plugin, "notify::screen",
- G_CALLBACK (global_plugin_notify_screen), global);
+ stage = mutter_plugin_get_stage (plugin);
+
+ g_signal_connect (stage, "notify::width",
+ G_CALLBACK (global_stage_notify_width), global);
+ g_signal_connect (stage, "notify::height",
+ G_CALLBACK (global_stage_notify_height), global);
+ update_screen_size (global);
}
void
{
global->root_pixmap = clutter_glx_texture_pixmap_new ();
+ clutter_actor_set_size (CLUTTER_ACTOR (global->root_pixmap),
+ global->last_change_screen_width,
+ global->last_change_screen_height);
+
clutter_texture_set_repeat (CLUTTER_TEXTURE (global->root_pixmap),
TRUE, TRUE);